-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NoQA] Optimise getReportOrDraftReport #47404
[NoQA] Optimise getReportOrDraftReport #47404
Conversation
@abdulrahuman5196 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
@rinej Do we need to do any specific testing for this? |
Basically we just refactored the |
@abdulrahuman5196 there is not much to test here I agree the logic remains same from what I can see in the code changes |
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid: mWeb ChromeiOS: NativeiOS: mWeb SafariMacOS: Chrome / SafariMacOS: Desktop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No logic changes basically just drying this up, thanks for that
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/mountiny in version: 9.0.24-0 🚀
|
1 similar comment
🚀 Deployed to staging by https://github.com/mountiny in version: 9.0.24-0 🚀
|
🚀 Deployed to production by https://github.com/marcaaron in version: 9.0.24-5 🚀
|
Details
This PR improves the performance of
getReportOrDraftReport
.In the latest Jason trace,
getReportOrDraftReport
took 76ms. In the dev environment, although timings vary, we achieved an improvement for around 25%While the performance improvement on dev is minor (a reduction from 167µs to 125µs in some cases, though not consistently), the benefit here is adding the DRY principle ( the code function was duplicated in three other places). After refactoring the code would be cleaner and more maintainable also we eliminated two additional Onyx connections calls.
When fixing the tests we also noticed that the
getReportOrDraftReport
was duplicated on purpose,It was introduced in that PR -> #40316
If it is still the case, please let me know so I will change the optimised function on 3 other places without applying DRY principles.
Before:
After:
Fixed Issues
$ #47556
PROPOSAL:
Tests
N/A
Offline tests
N/A
QA Steps
N/A
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.-[x] I verified that comments were added to code that is not self explanatory
src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop